package com.mo.axion.support.dao;

import com.mo.axion.support.domain.ChannelAccount;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

/**
 * @author Mo
 * @createTime 2024/2/23 20:10
 * @descripiton 渠道账号信息DAO
 */
public interface ChannelAccountDao extends JpaRepository<ChannelAccount, Long> {

    /**
     * 查询列表
     * @param isDeleted 0：未删除 1：删除
     * @param creator 账号拥有者
     * @param channelType 渠道类型代码
     * @return 渠道账号信息DTO
     */
    List<ChannelAccount> findAllByIsDeletedEqualsAndCreatorEqualsAndSendChannelEquals(Integer isDeleted, String creator, Integer channelType);

    /**
     * 查询列表方法重构
     *
     * @param isDeleted 0：未删除 1：删除
     * @param channelType 渠道类型代码
     * @return 渠道账号信息DTO
     */
    List<ChannelAccount> findAllByIsDeletedEqualsAndSendChannelEquals(Integer isDeleted, Integer channelType);

    /**
     * 根据创建者检索相关账户信息
     * @param creator 创建者
     * @return 渠道账号信息DTO
     */
    List<ChannelAccount> findAllByCreatorEquals(String creator);

    /**
     * 统计未删除的条数
     * @param isDeleted 0：未删除 1：删除
     * @return 数量
     */
    Long countByIsDeletedEquals(Integer isDeleted);

}
